Safiyyah (may Allah have mercy on her) narrated this hadith of the Prophet (peace and blessings be upon him) from one of the Mothers of the Believers (may Allah be pleased with them), that he (peace and blessings be upon him) said: "Whoever goes to a soothsayer and asks him about anything, his prayer will not be accepted for forty nights."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب القسامة / 16510