Deuteronomy 18:20

But the prophet who presumes to speak a word in My name, which I have not commanded him to speak, or who speaks in the name of other gods, that prophet shall die.'

Surrounding context

18:19 And it shall be that whoever will not hear My words, which He speaks in My name, I will require it of him.

18:20 But the prophet who presumes to speak a word in My name, which I have not commanded him to speak, or who speaks in the name of other gods, that prophet shall die.'

18:21 And if you say in your heart, "How shall we know the word which the LORD has not spoken?'--

Translation and sources