Abd al-Aziz bin Suhayb says: We asked Sayyiduna Anas bin Malik (may Allah be pleased with him): What did you hear from the Prophet (peace and blessings be upon him) about garlic? Sayyiduna Anas (may Allah be pleased with him) said: The Prophet (peace and blessings be upon him) said: "Whoever eats of this plant, let him neither come near our mosque nor pray with us."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5051