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

Narrated Sa`d bin Abi Waqqas:

The Prophet (ﷺ) said, "The most sinful person among the Muslims is the one who asked about something which had not been prohibited, but was prohibited because of his asking."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يَزِيدَ الْمُقْرِئُ، حَدَّثَنَا سَعِيدٌ، حَدَّثَنِي عُقَيْلٌ، عَنِ ابْنِ شِهَابٍ، عَنْ عَامِرِ بْنِ سَعْدِ بْنِ أَبِي وَقَّاصٍ، عَنْ أَبِيهِ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏ "‏ إِنَّ أَعْظَمَ الْمُسْلِمِينَ جُرْمًا مَنْ سَأَلَ عَنْ شَىْءٍ لَمْ يُحَرَّمْ، فَحُرِّمَ مِنْ أَجْلِ مَسْأَلَتِهِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 7289
In-book reference : Book 96, Hadith 20
USC-MSA web (English) reference : Vol. 9, Book 92, Hadith 392
  (deprecated numbering scheme)