Abu Amr (may Allah have mercy on him) narrates that he heard Ata (may Allah have mercy on him) say: A person should break off the prayer, leave and perform ablution. If he has not spoken to anyone (in the meantime), he should come back and continue on the same prayer.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3391