The Prophet ﷺ said, "A servant remains in a state of prayer as long as he is in the mosque waiting for the prayer, so long as he does not break his ablution."A non-Arab man asked, "Abu Hurayrah, what does breaking ablution mean?"He replied, "The sound," meaning passing wind.In another wording, "The prayer of any one of you is not accepted if he breaks his ablution until he performs ablution again."
قال النبي ﷺ: لا يزال العبد في صلاة ما كان في المسجد ينتظر الصلاة ما لم يحدث. فقال رجل أعجمي: ما الحدث يا أبا هريرة؟ قال: الصوت. يعني الضرطة. وفي لفظ: لا تقبل صلاة أحدكم إذا أحدث حتى يتوضأ.
Bukhari related it in the book of wudu (176), through Saeed Maqburi, and Muslim related it in the book of purification (225), through Hammam bin Munabbih, both of them from Abu Hurairah. He then mentioned the hadith. The rest of the hadiths will come in the book of prayer, in the chapter on waiting for the prayer.