It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) "was commanded to prostrate on seven bones, that is, seven limbs, and that one should not tuck up his clothes or hair during the prayer."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2677
Kurayb, the mawla (freedman) of Sayyiduna Ibn Abbas (may Allah be pleased with them both), says that Sayyiduna Ibn Abbas (may Allah be pleased with them both) saw Abdullah bin al-Harith praying with the hair of his head gathered and tied at the back. He (may Allah be pleased with him) stood behind him and began to untie his hair. When he finished the prayer, he turned to Sayyiduna Ibn Abbas (may Allah be pleased with them both) and said: What business do you have with my head? He said: I heard the Messenger of Allah (peace and blessings be upon him) saying: "The likeness of one who prays with his hair tied in a knot is like one who prays 'maktuf' (with his arms tied behind him)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2679
(a) Sa'id bin Abi Sa'id al-Maqburi narrates from his father that he saw Abu Rafi' (may Allah be pleased with him), the freed slave of the Prophet (peace and blessings be upon him), pass by Hasan bin Ali (may Allah be pleased with them both). He (may Allah be pleased with him) was praying, and he had made his locks into braids and tucked them behind his neck. Abu Rafi' (may Allah be pleased with him) undid those braids. Sayyiduna Hasan (may Allah be pleased with him) turned towards him in anger, so Abu Rafi' (may Allah be pleased with him) said: Carry on with your prayer and do not be angry, for I heard the Messenger of Allah (peace and blessings be upon him) say: "These braids of hair are the sitting place of Satan," meaning that tying the braids into a knot is forbidden.
(b) In the narration of Abd al-Razzaq, he (peace and blessings be upon him) said: "This is the sitting place of Satan."
(c) Narrations about the dislike of such a knot from Sayyiduna Umar, Ali, Hudhayfah and Abdullah bin Mas'ud (may Allah be pleased with them) have already passed.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2680