The Messenger of Allah ﷺ spent the night at Dhul-Hulayfah in the open plain and prayed in its mosque.
أخبرنا عيسى بن إبراهيم بن مثرود عن ابن وهب قال أخبرني يونس قال ابن شهاب أخبرني
بات رسول الله ﷺ بذي الحليفة ببيداء وصلى في مسجدها
Muslim narrated it in Hajj, chapter titled Prayer in the masjid of Zulhulayfa, hadith 1188, from the hadith of Abdullah bin Wahb, as related. It is also in Al-Kubra, hadith 3639.