كتاب الاعتصام بالكتاب والسنة
Holding Fast to the Qur'an and Sunnah
Chapter: Asking too many questions and troubling with what does not concern one
باب مَا يُكْرَهُ مِنْ كَثْرَةِ السُّؤَالِ وَتَكَلُّفِ مَا لاَ يَعْنِيهِ
Sahih al-Bukhari 7297

Narrated Ibn Masud:

I was with the Prophet (ﷺ) at one of the farms of Medina while he was leaning on a date palm leaf-stalk. He passed by a group of Jews and some of them said to the other, Ask him (the Prophet) about the spirit. Some others said, "Do not ask him, lest he should tell you what you dislike" But they went up to him and said, "O Abal Qasim! Inform us bout the spirit." The Prophet (ﷺ) stood up for a while, waiting. I realized that he was being Divinely Inspired, so I kept away from him till the inspiration was over. Then the Prophet (ﷺ) said, "(O Muhammad) they ask you regarding the spirit, Say: The spirit its knowledge is with my Lord (i.e., nobody has its knowledge except Allah)" (17.85) (This is a miracle of the Qur'an that all the scientists up till now do not know about the spirit, i.e, how life comes to a body and how it goes away at its death) (See Hadith No. 245, Vol. 6)

حَدَّثَنَا مُحَمَّدُ بْنُ عُبَيْدِ بْنِ مَيْمُونٍ، حَدَّثَنَا عِيسَى بْنُ يُونُسَ، عَنِ الأَعْمَشِ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، عَنِ ابْنِ مَسْعُودٍ ـ رضى الله عنه ـ قَالَ كُنْتُ مَعَ النَّبِيِّ صلى الله عليه وسلم فِي حَرْثٍ بِالْمَدِينَةِ، وَهْوَ يَتَوَكَّأُ عَلَى عَسِيبٍ، فَمَرَّ بِنَفَرٍ مِنَ الْيَهُودِ فَقَالَ بَعْضُهُمْ سَلُوهُ عَنِ الرُّوحِ‏.‏ وَقَالَ بَعْضُهُمْ لاَ تَسْأَلُوهُ لاَ يُسْمِعْكُمْ مَا تَكْرَهُونَ‏.‏ فَقَامُوا إِلَيْهِ فَقَالُوا يَا أَبَا الْقَاسِمِ حَدِّثْنَا عَنِ الرُّوحِ‏.‏ فَقَامَ سَاعَةً يَنْظُرُ فَعَرَفْتُ أَنَّهُ يُوحَى إِلَيْهِ، فَتَأَخَّرْتُ عَنْهُ حَتَّى صَعِدَ الْوَحْىُ، ثُمَّ قَالَ ‏{‏وَيَسْأَلُونَكَ عَنِ الرُّوحِ قُلِ الرُّوحُ مِنْ أَمْرِ رَبِّي‏}‏‏.‏
Reference : Sahih al-Bukhari 7297
In-book reference : Book 96, Hadith 28
USC-MSA web (English) reference : Vol. 9, Book 92, Hadith 400
  (deprecated numbering scheme)