Ezekiel 2:4-5 ESV I send you to them, and you shall say to them, 'Thus says the Lord GOD.' (5) And whether they hear or refuse to hear (for they are a rebellious house) they will know that a prophet has been among them.
Isaiah 6:9-10 ESV And he said, "Go, and say to this people: "'Keep on hearing, but do not understand; keep on seeing, but do not perceive.' (10) Make the heart of this people dull, and their ears heavy, and blind their eyes; lest they see with their eyes, and hear with their ears, and understand with their hearts, and turn and be healed."
Sometimes God does not want people to be saved. Sometimes he wants to demonstrate a measure of His Judgement. That doesn't mean that we should not speak the gospel.
The Spirit is in speaking the truth. And sometimes despite the lack of response, or expected response.