Language:
كتاب بدء الخلق
59  
Beginning of Creation
(16)
Chapter: Five kinds of animals are harmful and allowed to be killed in Haram
(16)
باب خَمْسٌ مِنَ الدَّوَابِّ فَوَاسِقُ يُقْتَلْنَ فِي الْحَرَمِ
Sahih al-Bukhari 3319

Narrated Abu Huraira:

Allah's Messenger (ﷺ) said, "Once while a prophet amongst the prophets was taking a rest underneath a tree, an ant bit him. He, therefore, ordered that his luggage be taken away from underneath that tree and then ordered that the dwelling place of the ants should be set on fire. Allah sent him a revelation:-- "Wouldn't it have been sufficient to burn a single ant? (that bit you): (See Page 162, chapter No. 153).

حَدَّثَنَا إِسْمَاعِيلُ بْنُ أَبِي أُوَيْسٍ، قَالَ حَدَّثَنِي مَالِكٌ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ ـ رضى الله عنه ـ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ نَزَلَ نَبِيٌّ مِنَ الأَنْبِيَاءِ تَحْتَ شَجَرَةٍ فَلَدَغَتْهُ نَمْلَةٌ، فَأَمَرَ بِجَهَازِهِ فَأُخْرِجَ مِنْ تَحْتِهَا، ثُمَّ أَمَرَ بِبَيْتِهَا فَأُحْرِقَ بِالنَّارِ، فَأَوْحَى اللَّهُ إِلَيْهِ فَهَلاَّ نَمْلَةً وَاحِدَةً ‏"‏‏.‏
Reference : Sahih al-Bukhari 3319
In-book reference : Book 59, Hadith 125
USC-MSA web (English) reference : Vol. 4, Book 54, Hadith 536
  (deprecated numbering scheme)