Answered by Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
The heart of a man has become attached to a woman who is unlawful for him to marry. How can he remove this attachment?
He must strive to fill his heart with longing to meet Allah and to be in the company of His Messenger ﷺ while pleading with Allah that He removes this attachment from his heart. At the same time, he should block off any things which remind him of this woman, such as meetings, conversations or photos. If he does these things, Allah will help him and not leave him to fall prey to his lower self or to the devil.