If you had gotten the quest and found where the key fits before entering the doctor's house, you could have asked him about it, but he would just have claimed to have lost the key and kicked you out anyway. Talking to him first will not effect the quest at all.