It's a good question.
I feel like God hears you no matter what so go for it, God hears you.
Growing up in church, I remember them being so formal about it, and it's of course good to be respectful when approaching God.
They basically would say it's like a letter:
Dear God/To God/ God, ..../ To God Our Heavenly Father (we approach with Thanksgiving in our hearts)/ To the Lord Most High/etc.
I would like to pray for my friend, you know their name and their needs. I pray that you would help them and that they would look to you in their struggle.
In Jesus Christ's Name/In the name of Jesus Christ/We leave you with these words, Dear Lord/etc.
Amen.
-With all those slashes in there, it's of course meaning there's probably a million and one ways to say a prayer and they wouldn't be wrong.
After reading the way King David would talk to God at times and how bold he was, I don't feel bad at all how I pray to God.
I don't believe a name is required to pray for someone. God knows who everyone is, their needs, and struggles. He knows it all. You could say, "I pray for this person that needs help right now," and you may know nothing about them, but God knows who you mean.
It always ticked me off when at the church I grew up in they would all be like, "What's their first name?" and then, "Okay, last name?" Like, as if that's important 100% of the time. Sometimes I didn't want my folks church in other people's business and if prayer was needed it was basically, "My co-worker; God knows the need." You can't be anonymous to God, but it's okay to be anonymous with other people.