The Messenger of Allah ﷺ used to pray in the sheepfolds before the mosque was built.
حدثنا محمد بن جعفر حدثنا شعبة عن أبي التياح وحجاج قال سمعت شعبة عن أبي التياح قال سمعت
أن رسول الله ﷺ كان يصلي في مرابض الغنم قبل أن يبنى المسجد
Its isnad is sahih, and it appears in Bukhari 1/117 in "The Book of Prayer," the chapter on praying in sheep pens, and in Muslim 1/374, no. 524, in "The Book of Masjids," the chapter on the masjid of the Prophet ﷺ.