The correct answer is: The doctor wanted to know when I had last taken my temperature. Given that the introductory verb (wanted) is in the past, you will have to apply the sequence of tenses in the remaining part of the sentence. This means that you will have to turn the verb one tense before. So, the verb (to take) is used in past simple here, and you need to form its past perfect form, which is had taken.