كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(80)
Chapter: The dismounting of the Prophet (saws) at Al-Hijr
(80)
باب نُزُولُ النَّبِيِّ صلى الله عليه وسلم الْحِجْرَ
Sahih al-Bukhari 4420

Narrated Ibn `Umar:

Allah's Messenger (ﷺ) said to his companions who were at Al-Hijr, "Do not enter upon these people who are being punished, except in a weeping state, lest the same calamity as of theirs should befall you..."

حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ، حَدَّثَنَا مَالِكٌ، عَنْ عَبْدِ اللَّهِ بْنِ دِينَارٍ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما ـ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم لأَصْحَابِ الْحِجْرِ ‏ "‏ لاَ تَدْخُلُوا عَلَى هَؤُلاَءِ الْمُعَذَّبِينَ إِلاَّ أَنْ تَكُونُوا بَاكِينَ، أَنْ يُصِيبَكُمْ مِثْلُ مَا أَصَابَهُمْ ‏"‏‏.‏
Reference : Sahih al-Bukhari 4420
In-book reference : Book 64, Hadith 442
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 704
  (deprecated numbering scheme)