Sunan Abi Dawud, Book 1, Hadith 29 (USC-MSA)

Narrated Abdullah ibn Sarjis: The Prophet prohibited to urinate in a hole. Qatadah (a narrator) was asked about the reason for the disapproval of urinating in a hole. He replied: It is said that these (holes) are the habitats of the jinn.

حَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ عُمَرَ بْنِ مَيْسَرَةَ، حَدَّثَنَا مُعَاذُ بْنُ هِشَامٍ، حَدَّثَنِي أَبِي، عَنْ قَتَادَةَ، عَنْ عَبْدِ اللَّهِ بْنِ سَرْجِسَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم نَهَى أَنْ يُبَالَ فِي الْجُحْرِ ‏.‏ قَالَ قَالُوا لِقَتَادَةَ مَا يُكْرَهُ مِنَ الْبَوْلِ فِي الْجُحْرِ قَالَ كَانَ يُقَالُ إِنَّهَا مَسَاكِنُ الْجِنِّ ‏.‏

sunnah.com

also referenced under: Hadith 29 (DarusSalam) & Hadith 29 (Hasan)