I think it's very strange and sad that people feel that a simple acknowledgement could be a threat or disrespect! I think it's just being polite to ask the kid "what's your name" because it's the one thing (that, and maybe age) that a young child is going to know and should be able to communicate. I think it's a way of acknowledging a child and saying "hello, you're not being ignored". Where you live, your phone number, any financial information, does daddy come home at night, your weight (haha) are in the personal information category, but a name is given so people outside the home may address you. That said, it is expected that for someone to speak to my child, they need to acknowledge me first even if it's just a look in the eye and a nod of the head, to which I would nod back if it was ok. I do the same before saying anything more than "Hi!" to a child I don't know. It's just kind of the social rules.
I think sometimes people may act a little paranoid because they are fearful and not confident in their ability to handle a situation, or read other people or social situations. Teaching a child to lie in an uncomfortable situation can only come back to haunt you later. That's just silly, and sends who knows what messages to the child: everything from confusion to fear?
When I was little we watched a cartoon with Mr T in it where we learned that ANYBODY can know your name (from your jersey or backpack, from hearing someone call you, whatever) so that doesn't mean ANYTHING. If something happens and someone needs to take you somewhere (mom had a car wreck, is in the hospital, whatever) then they need to know your secret family password. We sat down as a family and came up with our password, which we never used but still remember even though that was like 1987, and that was that. Mom went on to explain that if something happened to her and I needed to ride with someone else, there would always be SOMEONE I knew around to confirm this. Like if I was in school, then I would have to be called into the office and THEN the person who was talking to me would have to know the password. Or at the ballpark, the coach would take me to this new person. No legitimate adult would try to discuss something important or take me anywhere without first going to the adults that were in charge of me.
My son is 3 years old and I have been working with him on developing his confidence and self esteem. This way he'll be able to trust his gut when I'm not there. Another thing we do regularly is sit outside at sonic, the yogurt shop, or the patio at a restaurant and just chat and have a snack or meal together, while watching others. It's good to teach your children in a casual setting to look, watch, and understand things they're seeing. Show them personality or character traits (not judging by someone's looks). This way they can know if something is out of place better. My 3 year old can tell me "mommy, that lady looks sad" and I can ask why and him tell me that her book is making her sad, or maybe she doesn't have someone sitting by her, or whatever. He is noticing things, and that's better protection than not speaking to someone.
He used to say "hi!" to everyone in the world. I wondered about it, but didn't tell him to stop. Sometimes a big smile and a friendly greeting can really lift someone's spirits and I'm not going to stop that. But I have asked his childcare teachers and they say he doesn't talk (except for hi) to any adults except them. Other teachers in the hallway, or other parents, he just doesn't really talk to them unless I'm around. He will tell people who aren't too exaggerated his name and age, but that's about it. If a stranger (or adult) talks too much, I've noticed that he looks up at me for reassurance. I'll either smile and nod that all is ok or politely redirect or end the conversation, depending on the situation. I told him that he can play with kids that aren't too big. Strangers are big people who we don't know good enough to play with or have over for dinner. I explained it this way because we do have lawn guys, an occassional maintenance man, and quarterly pest control service, but we've never played with them or eaten with them. He knows he can be friendly with our adult friends who've come for dinner or a playdate. He'll learn more as he grows. But fear is not my goal; wisdom is.
A book I like a lot for kids, with a great way to explain it, is the Berenstein Bears learn about strangers. I would suggest that for you as an easy way to begin talking about stranger danger without instilling fear, AND there's the added bonus of spending quality time reading.