كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(49)
Chapter: The virtue of offering the obligatory prayers in congregation, the virtue of waiting for prayer and taking many steps towards the masjid, the virtue of walking to the masjid
(49)
باب فَضْلِ صَلاَةِ الْجَمَاعَةِ وَانْتِظَارِ الصَّلاَةِ ‏‏
Sahih Muslim 649 k

Abu Huraira reported:

The Messenger of Allah (ﷺ) said: Anyone amongst you who sat in a place of worship waiting for the prayer is in prayer and his ablution is not broken, the angels invoke blessing upon him (in these words): O Allah! pardon him. O Allah! have mercy upon him.
حَدَّثَنِي حَرْمَلَةُ بْنُ يَحْيَى، أَخْبَرَنَا ابْنُ وَهْبٍ، أَخْبَرَنِي يُونُسُ، ح وَحَدَّثَنِي مُحَمَّدُ بْنُ سَلَمَةَ الْمُرَادِيُّ، حَدَّثَنَا عَبْدُ اللَّهِ بْنُ وَهْبٍ، عَنْ يُونُسَ، عَنِ ابْنِ شِهَابٍ، عَنِ ابْنِ هُرْمُزَ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ أَحَدُكُمْ مَا قَعَدَ يَنْتَظِرُ الصَّلاَةَ فِي صَلاَةٍ مَا لَمْ يُحْدِثْ تَدْعُو لَهُ الْمَلاَئِكَةُ اللَّهُمَّ اغْفِرْ لَهُ اللَّهُمَّ ارْحَمْهُ ‏"‏ ‏.‏
Reference : Sahih Muslim 649k
In-book reference : Book 5, Hadith 344
USC-MSA web (English) reference : Book 4, Hadith 1399
  (deprecated numbering scheme)