Are you completely free to design this control? If I were designing a GUI control for this requirement, I would think about two ways of doing it.
One would be to completely reject a character which causes the input typed so far to no longer be a viable prefix for any matches. As in, make it impossible to type, but with some kind of feedback that the character is being rejected. (Something visual happens in the input field, and there is a sound; it must never look like the interface has become unresponsive.)
Another approach would be to allow the user to type arbitrary input (which is what you seem to want), but to apply syntax coloring to distinguish the valid prefix from an invalid suffix. Characters that do not complete could be colored red, or something like that, and the GUI would prevent that input from being submitted while it contains a trailing portion that is flagged as an invalid suffix.
The user can realize his or her mistake and backspace over the flagged characters.
At all times, the possible choices should be shown (unless there are too many, in which case you want to condense the list in some sensible way) and it should be possible for the user to just shortcut to one of the choices.