Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "When one of you stands for prayer, let him not spit in front of him, for as long as he is in prayer he is speaking privately with Allah Almighty; nor to his right, for on his right there is an angel. Let him spit to his left or under his foot, and let him bury it as well."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3599
Abu al-Ala narrates from his father (may Allah be pleased with him) that he prayed with the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) spat out phlegm, then rubbed it out with his left sandal.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3600