All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
The majority of scholars believe that it is disliked for a worshipper to stand alone in a row in the congregational prayer without an excuse and that it is not disliked if there is an excuse. Hanbali scholars believed that the prayer of whoever performed one Rak‘ah alone in a row without an excuse is invalid.
They also believed that the prayer of a worshipper who performed the bowing alone behind the rows and then joined the last row as the Imaam was raising his head from the bowing and had not yet performed the prostration is valid. They also believe that the prayer of one being led who performed the bowing alone behind the rows and then a late comer stood beside him before the Imaam ended his bowing and raised his head is valid as well.
Al-Mardaawi said in Al-Insaaf, "This is the opinion of Imaam Ahmad and the scholars of his school of Fiqh . Az-Zarkashi said "This is the famous opinion that most Shaafi‘i scholars adopt."
Hence, since you already knew that another late comer will stand next to you during this Rak‘ah, there is no harm in joining the prayer while standing alone in a row. However, if no one else joined the prayer and stood next to you, then it should be mentioned that the scholars held different opinions on whether you have to pull a person back from the row in front of you to stand next to you or not. Imaam An-Nawawi reported the difference of opinion among scholars in his book, Al-Majmoo‘, "A secondary issue in their school of Fiqh is regarding the worshipper pulling a person back from the row in front of him to stand next to him. We have mentioned that the correct opinion in our school of Fiqh is that the late comer should pull a person back from the row in front of him to stand next to him after reciting Takbeerat Al-Ihraam (i.e. the opening Takbeerah) if he could not find a place to stand in the last row. This was reported by Ibn Al-Munthir on the authority of ‘Ataa' and An-Nakh‘i . It was reported on the authority of Maalik, Al-Awzaa‘i, Ahmad and Is-haaq that it is disliked for a worshipper to pray alone in a row without an excuse. This is the opinion of Abu Haneefah and Daawood ."
Our opinion is that a worshipper in such a case should not pull a person back from the row in front of him and there is no harm if he prayed alone in a row. We have previously mentioned that it is not disliked for the worshipper to pray alone in the row as long as there is an excuse for doing so and the fact that there is no room for him to stand in the last row is a valid excuse.