According to the ahhadith of Ahlul-Bayt (as) and the Scholarly opinions, to guard your area of prayers is recommended and Sunnah, however does not break your prayer. We see a beautiful tradition below summing it up.
“Once, abu Hanifah went to see abu ‘Abd Allah, ‘Alayhi al-Salam. On his arrival he said, ‘I saw your son Musa perform Salat (prayer) while people passed by in front of him; but he did not stop them and it is questionable.’ Abu ‘Abd Allah, ‘Alayhi al-Salam, asked to call Musa. He was called and he asked, ‘Son, abu Hanifah says that you were performing Salat (prayer) and people passed by in front of you, but you did not stop them.’ He replied, ‘Yes, O father, the One for whom I was performing Salat (prayer) was closer to me than people passing by in front of me. Allah, most Majestic, most Glorious, says, “We are closer to him than the jugular vein.”’ (50:16) The narrator has said that he (the Imam) then embraced him and then said, ‘I pray to Allah to keep me and my mother in service for your cause, O reservoir of secrets.’ (Imam’s response is to show the significance of Salat (prayer) not to compromising any excellence.)”
Sanad: Ali ibn Ibrahim has narrated from his father in a marfu’ manner from Muhammad ibn Muslim who has said the above hadith
Source: al-Kafi, Volume 3, Chapter 180, Hadith #4
As for the proofs it is mustahhab (recommended) and Sunnah:
“Abu ‘Abd Allah, ‘Alayhi al-Salam, has said, ‘The Messenger of Allah would place his staff in front of the place where he performed Salat (prayer).’”
Sanad: Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from al-Hassan ibn Mahbub from Mu‘awiyah ibn Wahab who has said the above hadith
Source: al-Kafi, Volume 3, Chapter 180, Hadith #1
Grading: Allaamah Majlisi grades it Authentic/Sahih (صحيح) [Miara’at al-Uqool, Volume 15, Page 69 (See Second Image below)]
“I once asked abu ‘Abd Allah, ‘Alayhi al-Salam, about a man whose Salat (prayer) is discontinued because of something moving in front of him. He (the Imam) said, ‘Things do not discontinue Salat (prayer) of the believer, but guard it as much as you can.’”
Sanad: Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from ‘Uthman ibn ‘Isa from ibn Muskan from ibn abu Ya‘fur who has said the above hadith
Source: al-Kafi, Volume 3, Chapter 180, Hadith #3
Grading: Allaamah Majlisi grades it Reliable/Muwathaq (موثق) [Miara’at al-Uqool, Volume 15, Page 70 (See Second Image below)]
As for the scholarly opinions, we quote Sayed Sistani (hf):
If a person is offering prayers at a place where people are passing, or where somebody is present in front of him, it is Mustahab that he should set a demarcation before him, even by keeping a wooden stick, or a string.