Sahih Muslim , Book 3, Hadith 703 (USC-MSA) ⓘ
Abu Huraira reported: The Messenger of Allah said: If any one of you has pain in his abdomen, but is doubtful whether or not anything has issued from him, be should not leave the mosque unless he hears a sound or perceives a smell.
وَحَدَّثَنِي زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا جَرِيرٌ، عَنْ سُهَيْلٍ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " إِذَا وَجَدَ أَحَدُكُمْ فِي بَطْنِهِ شَيْئًا فَأَشْكَلَ عَلَيْهِ أَخَرَجَ مِنْهُ شَىْءٌ أَمْ لاَ فَلاَ يَخْرُجَنَّ مِنَ الْمَسْجِدِ حَتَّى يَسْمَعَ صَوْتًا أَوْ يَجِدَ رِيحًا " .
also referenced under: Book 3, Hadith 126 (In-Book) & Hadith 362 (Reference)