All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallahu ‘alayhi wa sallam, is His slave and Messenger.
First of all, we say that it is dangerous to take such a woman as a friend; the Islamic Shariah urges Muslims to choose their friends carefully. Abu Hurayrah, may Allah be pleased with him, reported that the Prophet, sallallahu ‘alayhi wa sallam, said, "A man tends to follow the religion of his intimate friend; so each one of you (Muslims) should be cautious whom he befriends." [Ahmad, Abu Daawood, and At-Tirmithi]
The Prophet, sallallahu ‘alayhi wa sallam, also underlined that friends have an influence on each other. Abu Moosa, may Allah be pleased with him, narrated that the Prophet, sallallahu ‘alayhi wa sallam, said, "The example of a good companion and an evil one is that of a person carrying musk and another blowing a pair of bellows. The one who is carrying musk will either give you some perfume as a present, or you will buy some from him, or you will get a good scent from him, but the one who is blowing a pair of bellows will either burn your clothes or you will get a bad smell from him." [Al-Bukhaari and Muslim]
Hence, you should beware of befriending this woman. There is no harm in visiting her without the presence of that man with the two of you, especially if you hope that visiting her would realize a Shariah-acceptable benefit, such as giving her advice, attempting to reform her, or urging her to cut off that illegitimate relationship. Otherwise, it is better to refrain from visiting her. For more benefit, please refer to fatwa 81356.
Allah knows best.