Asking an exam question that requires a specific technique
You say, "Solve for Y. You must use X technique to demonstrate that you know how to use it, even though there may be simpler other ways to solve this particular problem."
Edit: One should cover in class why the students need to know X. The point in the exam question is to make it clear that using X is a requirement of the question, not a hint.
Example: "Use a Karnaugh map to simplify the following Boolean expression." Here, the question asks, "use a Karnaugh map," not "simplify the expression." The latter is the mechanism to demonstrate the former.
I second Bob Brown's suggestion of writing explicitly in the question that X technique must be used.
As to the concern that they will get a mistaken impression as to the usefulness of X: don't rely on the exam to convey this idea! My philosophy is that an exam is just to assess the student's knowledge and understanding. I don't find that it works well to assign an "interesting" exam problem from which the student is supposed to learn something new. An exam setting is too stressful to be a good time to acquire new knowledge.
Presumably there are examples that illustrate the full power of technique X, where simpler techniques don't work well. You can still have the students work those examples; just not on an exam. Maybe as a homework assignment, or a term project, or whatever. Hopefully by the end of the course, they've done enough of them that one "toy" example on the exam is not going to distort their impression of the technique's power.
(If your educational system uses exams as the sole graded element of the class, so that you can't realistically assign projects and such - my condolences. I don't have any brilliant ideas in that case.)
Especially, how can such a question be asked to avoid having students erroneously discount the importance of technique X because a simpler method exists for the particular problem?
I think you're looking at it the wrong way. If you want students to use a particular technique to solve a problem, then I think it should be your responsibility to design a problem where this is the best solution. Asking your students to use a (self-admitted) suboptimal technique to solve a problem is convoluted and goes against any problem-solving skill they might have developed.
Also, if you want your students to understand the importance of technique X, then you must show them problems where it really is the best solution.