Sayyiduna Ibn Umar (may Allah be pleased with them both) said: I heard the Prophet (peace and blessings be upon him) say: "Whoever enters the mosque while the imam is standing leading the prayer has no separate prayer; he should not pray alone by himself, but should join the imam in the prayer."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 13557