It is important for men to wear a topi while offering namaz as it is a Sunnah.
Our Prophet Mohammad (saw) used to wear a topi on his head during naamz.
To cover the head, using a turban or wearing a skull cap (Topi) is Sunnah. The Holy Prophet Mohammad (saw) used to tie a turban on the cap.
It has been narrated on the authority of Hazrat Abdullah bin Umar (ra) that the Holy Prophet Mohammad (saw) used to wear a white cap. ( Majma Uz Zawaaid, Vol. 5, Pg No. 121).
There is a Hadith in Jame' Tirmidhi that has been translated as follows, “Indeed! The difference between us and the mushrikeen (those who assign partners to Allah Ta'ala) is turbans tied on caps.(Jame' Tirmidhi, Vol. 1, Pg No. 308).
The cap or topi is mentioned in the Hadith and we learn that in the blessed era of the Holy Prophet Mohammad (saw), caps were quite common and especially for namaz the turbans were worn, as mentioned in Sahih Bukhari:
Translation of Hadith, “The great Tabi'ee Hadhrat Hasan Basri (ra) says: Due to the heat, the Sahabah, would perform Sajdah on their caps and turbans and their hands would be in their sleeves. (Sahih Bukhari, Vol. 1, Pg No. 56).
In another Hadith, the Holy Prophet Mohammad (saw) was asked about the clothes of Ihram and He (saw) replied: (Translation of Hadith) “You should not wear tunics (kameez in Urdu), nor pajamas, neither turbans nor caps..(Sahih Bukhari, Vol. 1, Pg No. 248, Hadith No: 1838)
This Hadith shows that the Sahabah would usually wear turbans and caps. Therefore, the Holy Prophet Mohammad (saw) stopped them from wearing them in Ihram.
Thus, the Masnoon and Mustahab (established by the Sunnah and the praiseworthy) way is that naamz should be offered with the head covered. Not doing because of laziness is Makruh or undesirable, as has been mentioned in Durre Mukhtaar,Vol. 1, Pg No. 474 and Raddul Muhtaar, Vol. 1, Pg No. 474: Translation of Hadith, “Offering namaz without covering the head is Makruh. Covering the head should not be considered a chore due to laziness and should not be neglected.
And Allah Subhanahu Wa Ta'ala knows the best.
Keep Me In Your Prayers