Sayyiduna Abu Qatadah Ansari (may Allah be pleased with him) reports: The Prophet (peace and blessings of Allah be upon him) said: "When any one of you enters the mosque, he should not sit down before performing two rak‘ahs of prayer."
Related hadith on this topic