Hadithcore
Sunan Abi Dawud, 490
da’if· Al-Albani

Narrated Ali ibn AbuTalib:

AbuSalih al-Ghifari reported: Ali (once) passed by Babylon during his travels. The mu'adhdhin (the person who calls for prayer) came to him to call for the afternoon prayer. When he passed by that place, he commanded to announce for the prayer. After finishing the prayer he said: My affectionate friend (i.e. the Prophet) prohibited me to say prayer in the graveyard. He also forbade me to offer prayer in Babylon because it is accursed.

حَدَّثَنَا سُلَيْمَانُ بْنُ دَاوُدَ، أَخْبَرَنَا ابْنُ وَهْبٍ، قَالَ حَدَّثَنِي ابْنُ لَهِيعَةَ، وَيَحْيَى بْنُ أَزْهَرَ، عَنْ عَمَّارِ بْنِ سَعْدٍ الْمُرَادِيِّ، عَنْ أَبِي صَالِحٍ الْغِفَارِيِّ، أَنَّ عَلِيًّا، - رَضِيَ اللَّهُ عَنْهُ - مَرَّ بِبَابِلَ وَهُوَ يَسِيرُ فَجَاءَهُ الْمُؤَذِّنُ يُؤَذِّنُ بِصَلاَةِ الْعَصْرِ فَلَمَّا بَرَزَ مِنْهَا أَمَرَ الْمُؤَذِّنَ فَأَقَامَ الصَّلاَةَ فَلَمَّا فَرَغَ قَالَ إِنَّ حَبِيبِي صلى الله عليه وسلم نَهَانِي أَنْ أُصَلِّيَ فِي الْمَقْبُرَةِ وَنَهَانِي أَنْ أُصَلِّيَ فِي أَرْضِ بَابِلَ فَإِنَّهَا مَلْعُونَةٌ ‏.‏

References2 variants
In-Book Reference
Book 2, Hadith 100
English Reference
Book 2, Hadith 490