Mosques and places of Prayer - Section 2 Mishkat al-Masabih 737

Arabic hadith text
وَعَنْ أَبِي سَعِيدٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «الْأَرْضُ كُلُّهَا مَسْجِدٌ إِلَّا الْمَقْبَرَةَ وَالْحَمَّامَ» . رَوَاهُ أَبُو دَاوُدَ وَالتِّرْمِذِيُّ والدارمي
Translation

Abu Sa'id reported God’s Messenger as saying, “The whole earth is a mosque, with the exception of a graveyard and a bath.” Abu Dawud, Tirmidhi and Darimi transmitted it.