Sahih al-Bukhari, Hadith 856 ⓘ
Narrated `Abdul `Aziz: A man asked Anas, "What did you hear from the Prophet about garlic?" He said, "The Prophet said, 'Whoever has eaten this plant should neither come near us nor pray with us."
حَدَّثَنَا أَبُو مَعْمَرٍ، قَالَ حَدَّثَنَا عَبْدُ الْوَارِثِ، عَنْ عَبْدِ الْعَزِيزِ، قَالَ سَأَلَ رَجُلٌ أَنَسًا مَا سَمِعْتَ نَبِيَّ اللَّهِ صلى الله عليه وسلم فِي الثُّومِ فَقَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم " مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ فَلاَ يَقْرَبْنَا، أَوْ لاَ يُصَلِّيَنَّ مَعَنَا " .
also referenced under: Book 10, Hadith 247 (In-Book) & Volume 1, Book 12, Hadith 815 (USC-MSA)