Praise be to Allah.
The four imaams – al-Shaafa’i, Malik, Abu Haneefah and Imam Ahmad (according to one opinion narrated from him) – said that the prayer of a person standing alone behind a row is valid, whether the row in front of him is complete or not. They said that the hadeeth “There is no prayer for the one who stands alone behind a row”
(reported by Ahmad in al-Musnad, 4/23 and by Ibn Maajah, no. 1003, and classed as saheeh by al-Albani in al-Irwa’, no. 514) is like the hadeeth “There is no prayer when there is food prepared” (reported by Muslim, no. 560). The meaning is that the prayer is not proper and complete. But there is a report from Ahmad that the prayer of the person who stands alone behind the row is not valid at all. This is the well-known view in the madhhab of Imaam Ahmad: the prayer of the person who stands alone behind the row is not valid in any circumstances, even if the last row is full.
Shaykh al-Islam Ibn Taymiyah took a moderate view, and said: “If the row is full, then the prayer of the one who stands alone behind the row is valid, because in this case he is not able to be a part of the row, and Allah does not burden a person beyond his scope. If the row is not full, then it is not right for him to pray standing alone behind the row, because he has no excuse.” This is the view of Shaykh al-Islam and of our Shaykh ‘Abd al-Rahmaan al-Sa’di (may Allah have mercy on him). This is the view that we think is correct, which is that if the row is full, pray standing on your own, and do not pull someone out of the row to join you or go and stand with the imaam in front. This is the correct opinion, which we think is closer to the Sunnah than the opinion that the prayer of the one who stands on his own is absolutely invalid or is unconditionally valid. And Allah knows best. (Liqa’ al-Bab al-maftooh by Ibn ‘Uthaymeen, 226).