The Messenger of Allah ﷺ said, "When one of you places before him something like the back of a saddle, let him pray and not be concerned with whoever passes beyond it."
حدثنا قتيبة وهناد قالا حدثنا أبو الأحوص عن سماك بن حرب
قال رسول الله ﷺ إذا وضع أحدكم بين يديه مثل مؤخرة الرحل فليصل ولا يبالي من مر وراء ذلك
Muslim also reported it, in the Book of Prayer, chapter on the sutrah of the one praying and the recommendation to pray toward a sutrah, etc., hadith 499, from Qutayba bin Saeed, with the same chain.There are also narrations on this subject from Abu Hurairah [Abu Dawud, hadith 689, 690, and Ibn Majah, hadith 943], Sahl bin Abu Hathma [Abu Dawud, hadith 695], Ibn Umar [Bukhari, hadith 494, and Muslim, hadith 501], Sabra bin Mabad Juhani [Ahmad, 3/404, and Ibn Khuzayma, hadith 810], Abu Juhayfa [Bukhari, hadith 187, and Muslim, hadith 503], and Ayesha [Muslim, hadith 500].