This chapter spans parts of two years of on-going war between Syria and Israel, and the verses you quote (13 and 28) apply to previous situations, not the one in verse 42, which you ask a question about. Here is one summary of the chapter:
"This chapter is a history of a war between Ben-hadad king of Syria
and Ahab king of Israel, in which Ahab was once and again,
victorious... Here is
I. Ben-hadad's descent upon Israel, and his insolent demands (v.
1-11).
II. The defeat Ahab gave him, encouraged and directed by a prophet (v.
12-21).
III. The Syrians rallying again, and the second defeat Ahab gave them
(v. 22-30).
IV. The covenant of peace Ahab made with Ben-hadad, when he had him at
his mercy (v. 31-34), for which he is reproved and threatened by a
prophet (v. 35-43)." Matthew Henry's Commentary pp 407-8.
To answer the question as to how Ahab could have known that God required Ben-hadad to be devoted to destruction, earlier scriptures need to be taken into account, including Ahab's disgraceful earlier rulership when his pagan wife, Jezebel manipulated and over-ruled him. Once the whole history of Ahab is examined, then the events in chapter 20 culminate to show that he had wasted several opportunities to smash this Syrian king's on-going threat over Israel.
By the end of chapter 20, Ahab then entered into a covenant with this wicked ruler, which God never authorised. Indeed, that was the exact opposite to God's express commands. All kings of Israel were required to write for themselves a copy of God's law, so Ahab would have no excuse for ignoring God's command:
"...for I will deliver the inhabitants of the land into your hand; and
thou shalt drive them out before thee. Thou shalt make no covenant
with them, nor with their gods. They shall not dwell in thy land,
lest they make thee sin against me: for if thou serve their gods, it
will surely be a snare to thee." Exodus 23:31-33 [emphasis mine]
Previous verses spoke of God cutting off all Israel's enemies, expressly stating, "but thou shalt utterly overthrow them, and quite break down their images." (vss. 23-24 & 27) This "cutting off" meant death. And God forbade making covenants with those nations. The answer is that Ahab should have known all of that, and was without excuse.