The given sentence means that the subject will only go under the condition that Mary also goes along with him/her. In the answer, the subject(I) and the object(Mary) remains the same. Thus, the rest of the phrase must mean 'will only go if the object goes'.
Option A is incorrect. It means that the subject will go if Mary does not go whereas the sentence suggests that the subject won't go under this condition. Thus, it is incorrect.
Option B is incorrect. It means that the subject won't go under the condition that Mary is going whereas the sentence suggests that the subject will go under this condition. Thus, it is incorrect.
Option C is correct. It means that the subject will not go if Mary does not go with him/her. The sentence suggests that the subject will only go if Mary comes along. Thus, it can be said that if Mary does not go, the subject will not either. Therefore, option C has the same meaning as the required one.
Option D is incorrect. It means that the subject will not go at the time Mary is going. It suggests that the subject may go at a different time or not at all. Since the required meaning should not suggest anything like that, it is incorrect.