Messenger of Allah ﷺ saw a person sitting aloof and not praying with the people. He asked him, "O so and so! What prevented you from offering the prayer with the people?" He replied, "O Messenger of Allah ﷺ! I am Junub and there is no water." The Prophet ﷺ said, "Perform Tayammum with clean earth and that will be sufficient for you."
أَنَّ رَسُولَ اللَّهِ ﷺ رَأَى رَجُلاً مُعْتَزِلاً لَمْ يُصَلِّ فِي الْقَوْمِ فَقَالَ يَا فُلاَنُ مَا مَنَعَكَ أَنْ تُصَلِّيَ فِي الْقَوْمِ فَقَالَ يَا رَسُولَ اللَّهِ أَصَابَتْنِي جَنَابَةٌ وَلاَ مَاءَ قَالَ عَلَيْكَ بِالصَّعِيدِ فَإِنَّهُ يَكْفِيكَ