I'd like to add some further hints on this, although Honigkuchenpony and rogermue basically answered the question.
In the first step we remove the subordinate clause.
Sie können mit dem Arzt nur sprechen.
Sie können nur mit dem Arzt sprechen.
The first sentence means: You can only talk to the doctor. Nothing else. It's just about talking.
The second sentence means: You can talk only to the doctor. Nobody else. Just the doctor.
In a second step, you can add some further content, given in a subordinate clause. This may or may not change the meaning.
Sie können mit dem Arzt nur sprechen, er wird ihnen aber nicht helfen. (Same meaning as above.)
Sie können mit dem Arzt nur sprechen, wenn sie einen Termin vereinbart haben. (Different meaning.)
Sie können nur mit dem Arzt sprechen, nicht aber mit der Krankenschwester. (Same meaning.)
Sie können nur mit dem Arzt sprechen, wenn sie einen Termin vereinbart haben. (Different meaning.)
Adding ...wenn sie einen Termin vereinbart haben is possible in both cases and changes the meaning of the stand-alone sentence. In both cases you end up with the same result.
This is possible because nur gets a slightly different meaning when adding this part. It's meaning then is nur dann or nur in dem Fall.
Note the subordinate clause has some power here, as you can even mix up the explanation that fits to the original meanings of the stand-alone sentences.
Sie können mit dem Arzt nur sprechen, nicht aber mit der Krankensprecher.
Sie können nur mit dem Arzt sprechen, er wird ihn aber nicht helfen.
Actually, these sentence are a little semantically odd. However, the first says you can just talk to the doctor but you cannot just talk to the nurse. The latter says the same as the stand-alone sentences but adds a further information which actually has nothing to do with the first part. Probably a dash(–) instead of a comma would make more sense there.