How did John Doe get past the dogs that you see in a scene in Se7en where Det. Somerset has dinner at the Mills' or warned Tracy that John Doe wanted to harm/kill her?
Probably because they were locked up
Firstly, the dogs aren't guard dogs, they are house pets and don't attack strangers automatically and they would have no way of knowing that John Doe was there to kill Tracey.
However, as I said, what we do know is that the dogs don't generally have the run of the Mills' apartment.
They're kept shut into a separate room as we see when Somerset comes for dinner and Mills plays with them.