Language:
كتاب أحاديث الأنبياء
60  
Prophets
(17)
Chapter: The Statement of Allah Taa'la: "And to Thamud (people, We sent) their brother Salih..."
(17)
بَابُ قَوْلِ اللَّهِ تَعَالَى: {وَإِلَى ثَمُودَ أَخَاهُمْ صَالِحًا}
Sahih al-Bukhari 3380

Narrated `Abdullah bin `Umar:

When the Prophet (ﷺ) passed by (a place called) Al Hijr, he said, "Do not enter the house of those who were unjust to themselves, unless (you enter) weeping, lest you should suffer the same punishment as was inflicted upon them." After that he covered his face with his sheet cloth while he was on the camel-saddle.

حَدَّثَنِي مُحَمَّدٌ، أَخْبَرَنَا عَبْدُ اللَّهِ، عَنْ مَعْمَرٍ، عَنِ الزُّهْرِيِّ، قَالَ أَخْبَرَنِي سَالِمُ بْنُ عَبْدِ اللَّهِ، عَنْ أَبِيهِ ـ رضى الله عنهم أَنَّ النَّبِيَّ صلى الله عليه وسلم لَمَّا مَرَّ بِالْحِجْرِ قَالَ ‏ "‏ لاَ تَدْخُلُوا مَسَاكِنَ الَّذِينَ ظَلَمُوا إِلاَّ أَنْ تَكُونُوا بَاكِينَ، أَنْ يُصِيبَكُمْ مَا أَصَابَهُمْ ‏"‏‏.‏ ثُمَّ تَقَنَّعَ بِرِدَائِهِ، وَهْوَ عَلَى الرَّحْلِ‏.‏
Reference : Sahih al-Bukhari 3380
In-book reference : Book 60, Hadith 54
USC-MSA web (English) reference : Vol. 4, Book 55, Hadith 563
  (deprecated numbering scheme)