Sayyiduna Anas bin Malik (may Allah be pleased with him) says: the Messenger of Allah (peace and blessings be upon him) led the people in prayer. A donkey passed in front of him, and Ayyash bin Abi Rabi'ah (may Allah be pleased with him) said: 'Subhan Allah, Subhan Allah' (Glory be to Allah, glory be to Allah)! When the Messenger of Allah (peace and blessings be upon him) concluded the prayer with the salam, he said: "Who said Subhan Allah just now?" Ayyash (may Allah be pleased with him) said: "I did, O Messenger of Allah! I had heard that a donkey (by passing in front) breaks the prayer." He (peace and blessings be upon him) said: "Nothing breaks the prayer," meaning the prayer is not invalidated by anything passing in front.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3506