I was in a situation once when I got a word of knowledge for a brother in the Lord about pain in his legs. There happened to be another brother standing there next to him, who I knew was not walking uprightly before the Lord. This brother laid his right hand on the shoulder of the brother in need of healing while I ministered to his legs. After I ministered, there was no change. I didn't pray again. I just told him I'd speak with him in a few minutes. About ten minutes later I took him aside, just the two of us and I ministered to him again the same way. The fire of God came on him so much that he said his legs felt like they were on fire. That feeling of fire remained for at least 15 minutes. Of course, all the pain left his legs.
I'm not passing judgment on the brother who was not walking uprightly before the Lord, but the Holy Spirit wouldn't flow with His power. There's no fellowship between light and darkness and the Holy Spirit won't put His stamp of approval of sinful behavior when the person knows better. The brother with sin in his life was not an ignorant, new believer. He'd been a believer for years with the word of God in him. He was accountable. There's a scripture verse in 1Timothy that shows this truth. Some people may not think this particular verse applies this way, but to me it seems to fit.
1Timothy 5:22 shows this truth.
Do not be hasty in the laying on of hands, and do not share in the sins of others. Keep yourself pure. - 1Timothy 5:22