[Machine] The Messenger of Allah ﷺ said, "The whole earth is a mosque except for the graveyard and the bathroom." This hadith of Al-Thawri is marfu' (attributed directly to the Prophet) and has been reported continuously. Additionally, the hadith of Hammad ibn Salamah is also marfu', and it has been followed in its chain by Abd al-Wahid ibn Ziyad and Al-Daraqutni.
قَالَ رَسُولُ اللهِ ﷺ الْأَرْضُ كُلُّهَا مَسْجِدٌ إِلَّا الْمَقْبَرَةَ وَالْحَمَّامَ حَدِيثُ الثَّوْرِيِّ مُرْسَلٌ وَقَدْ رُوِيَ مَوْصُولًا وَلَيْسَ بِشَيْءٍ وَحَدِيثُ حَمَّادِ بْنِ سَلَمَةَ مَوْصُولٌ وَقَدْ تَابَعَهُ عَلَى وَصْلِهِ عَبْدُ الْوَاحِدِ بْنُ زِيَادٍ وَالدَّرَاوَرْدِيُّ