I don't have much experience with dogs, much less untrained off leash ones. One is pretty big (a lab maybe?) and always runs right up to me and my wife barking territorially whenever I'm out in my garden, and doesn't stop until one of my neighbor's kids comes and gets them. I've had dogs try to fight me before and they make me really nervous. I just want to touch grass :(
How should I be responding to the dog when this happens?
I was a letter carrier for years so I have a ton of experience with getting to know strangers dogs. If there is a fence between the yards when the dog comes out to bark hold your hand low against your side of the fence so it has a good chance to sniff you. If your kinda friendly with your neighbors have them come shake your hand while the dog is there, having the owner speak to you in a friendly manor helps but it's my experience that when a dog actually see you physically interact with their person it helps a lot. Giving treats can also help but it will likely make the dog bark bark even more because it wants to get your attention and the corresponding treats.
Most dogs are all bark and no bite but it always pays to be cautious till the dog knows you.