We often underestimate the levels of sarcasm and innuendo present in the Bible writers, often falsely attributing to them only simple speech and pious blessings. Life is and never was that simple.
When Hazael presented himself before the prophet Elisha, he immediately saw through the messenger's murderous intentions and immediately saw how Hazael intended to usurp the throne by deception and regicide. Elisha knew that Hazael would lie to the king to gain his confidence.
Thus, Elisha said to Hazael something like, "Say to Ben Hadad, You will certainly recover because that is what you will say to him no matter what I say. However, the king will die, not from this disease but by your hand."
If Hazael had reported Elisha's words to the king in full, no lie would have been told.
Commentaries reach a similar conclusion. Note the Pulpit Commentary on 2 Kings 8:10 -
What Elisha says to Hazael is, "Go, say unto him, Thou shalt surely
live;" i.e. "Go, say unto him, what thou hast already made up thy mind
to say, what a courtier is sure to say, Thou shalt recover." Howbeit
the Lord hath showed me that he shall surely die. If Hazael had
reported the whole answer to Benhadad, he would have told no lie, and
thus Elisha is not responsible for his lie.
Ellicott reaches an identical conclusion.
Thou wilt certainly live. Elisha sees through Hazael's character and
designs, and answers him in the tone of irony which he used to Gehazi
in 2 Kings 5:26, "Go, tell thy lord--as thou, the supple and
unscrupulous courtier wilt be sure to do--he will certainly recover. I
know, however, that he will assuredly die, and by thy hand." Others
interpret, "Thou mightest recover" (i.e., thy disease is not mortal);
and make the rest of the prophet's reply a confidential communication
to Hazael. But this is to represent the prophet as deceiving Benhadad,
and guilty of complicity with Hazael, which agrees neither with
Elisha's character nor with what follows in 2 Kings 8:11-12.