Translation:Why didn't she ask herself that question.
My literal translation "Why didn't she ask that question herself" was deemed incorrect by Duo. The Duo version "Why didn't she ask herself that question" has quite a different meaning in English. So how would my version be translated into German?
Why didn't she ask that question herself? = Warum hat sie diese Frage nicht selbst gestellt?
Yes - that means something else.
Why didn't she ask herself this question? = Why did she not ask this question to herself?
Why didn't she herself ask this question? = Why did not she (and nobody else) ask this question (to someone)?
(The translation for that is the same as for Why didn't she ask that question herself?; see the thread started by paulcan.)
I wrote "Why did she not ask this question to herself" and got it wrong
No, it does not. Your sentence would be Warum hat sie die Frage nicht selbst gestellt?.
Duo’s sentence is about asking yourself (i.e. you yourself are the listener; you are speaking to yourself when you ask the question), while your sentence is about asking yourself (as opposed to someone else asking) and leaves open who the listener is.
Warum nicht „warum hat sie ihr diese Frage nicht gestellt“? Ich glaube, dass man das Reflexivpersonalpronomen im Dativ benutzen muss, wenn es im Satz ein direktes Objekt gibt.
The dative form of sich is also sich.
Warum hat sie ihr diese Frage nicht gestellt? would be "Why didn't she ask her this question?", with non-reflexive "her" rather than reflexive "herself" -- implying that she asked someone else the question.