The mirror hangs from a single strap, and is heavy enough that whatever I use needs to go into the stud.I know that the water pipe is there, running along the side of the stud. I have tried using a stud finder, and there appears to be a gap in the stud - I assume the break between the stud and the pipe. But I still can't tell which side is pipe and which is stud. Because the strap hangs well above the mirror, I don't want to go poking around in the drywall if I can avoid it as this will leave an unsightly mess. Help, please!
Use the stud finder across a wider swath of wall. Using a pencil, removable tape, or other method mark the edges of every stud you can find, including the possible edges where the mirror should hang. Measure the spacing of several studs. Do you find two or three that are spaced the same - 16 inches, perhaps? Builders like to place the studs with consistent spacing.
Does one of the "maybe a stud, maybe a pipe" markings follow the spacing pattern you observed with the other studs? If so, that's where your stud is.
You could also look inside the vanity. The pipe emerges from the wall in there, right? Measure how far it is to some reference like an adjoining wall. The pipe will probably go straight up from there, so you can use the same measurement up at mirror level to identify where the stud isn't.