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 is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
Wearing a cap in prayer is permissible whether it is white or any other color and whether it has holes or not, provided it is not made of something that we (men) are not allowed to wear, like silk. The questioner is most likely asking about the ruling of covering the head during prayer and the ruling about a person who does not cover his head in prayer. The scholars agreed that covering the head in prayer is not obligatory and they also agreed that the prayer of the person who prays without covering his head is accepted. The head of a man is not a part of the ‘Awrah (parts of the body that must be covered in Islam) whether in prayer or outside the prayer. However, they stated that it is desirable to cover the head during prayer, as this is adorning oneself. Allaah Says (which means): {O children of Adam, take your adornment [i.e. wear your clothing] at every mosque.}[7:31]. This was the practice at the time of the Prophet and his companions . So this matter is confirmed for the people of excellence like the scholars, Imaams and the like. Finally, the Hanafi school is of the view that it is disliked for a man to pray without covering his head.
Allaah Knows best.