It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Allah Almighty says: 'I am the third of two partners as long as neither of them betrays the other; when one of them betrays, I depart from between them.'"
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشركة / 11424