While, as others have already pointed out, it is important to make the criteria of a question explicit (e.g. words like "must" or "required" are a good bet), I believe that there's a bigger underlying problem, namely a disconnect in expectations, that cannot be solved by wording alone.
The task "demonstrate knowledge of a specific technique", where the technique is not an optimal fit for the problem, is quite uncommon outside of exam-like situations. Many students will not have encountered this kind of question very often. It is also counterintuitive to anyone already used to working in the problem domain, as they are usually more aware of what method is appropriate under specific circumstances. *
In addition, outside of trivial problems, there's always more than one way to use a tool, and whether or not two approaches are considered equivalent may depend on the level of abstraction (and experience). Personally, as a student with extensive prior knowledge across different fields, I used to have a hard time judging whether an instructor was
- aware of a simpler alternative solution, but intending to introduce it later
- aware of an alternative solution, but ignoring it to highlight a specific technique
- not aware, but open to unexpected approaches
- not aware, and will dismiss anything but the expected solution
- expecting a variant of an approach I wasn't even thinking of (e.g. same concept, different notation)
- just copy-pasting a question from a textbook without thoroughly examining it
More often than not, I ended up answering the question exactly as stated only to find there were subtle differences in interpretation, resulting in anything from zero to full (sometimes +bonus) points.
Add time constraints, ambiguous wording and the potential for errors or "trick" questions into the mix, and it's not surprising that a student might ignore what they perceive as a hint and solve the problem in the most efficient way they know.
While there may be good reasons to design an exam around a "suboptimal" approach, you should not expect a student to be automatically familiar with your course's context, philosophy and didactic goals.
More specifically, don't expect students to know what piece of knowledge you're trying to assess. A question defined in, say, two or three sentences is bound to infer a lot of context, and accurately limiting the scope is a difficult task.
If you give a list of techniques that are not allowed, expect at least one student to come up with something you didn't even consider. If you teach a particular variant of a method, or a particular notation, expect at least one student to have learned the method from a different source and do it that way.
Do make your question as clear as possible, but don't expect phrasing alone to solve the issue entirely.
Consider publishing a short guideline on question intent and scope that addresses frequent misunderstandings. Include pointers on notation and allowed axioms. Make it general or exam specific, as needed. The point is to move useful "boilerplate" info and caveats out of the text of each question, so questions can remain concise, but will be less ambiguous.
When possible for the question, give students some way to quickly assess whether they're "on the right track".
E.g. "A correct answer will have the following form/characteristics..."
*While restrictions like this can sometimes be encountered in research, as previously commented in the "Inadmissible theorems" question, these tend to be self-imposed and can be traced to a specific goal.