If you feel you are in command of the situation right from the start you can simply make your opening line, "Hi! What's your name?" This would be typical if you had some eye contact and positive response from the girl prior to your approach.
Another situation can involve a girl who just won't give you her name, although she will continue to talk to you. She may be teasing you, or she may be reluctant to introduce herself. In either case you should keep talking to her, but keep returning to the subject of her name and coaxing her to tell you.
It is good to know the girl's name as soon as possible, since calling her by name in conversation is a very important step in establishing friendship.
Sometimes, if you find yourself placed in a casual situation with a girl where you can start talking naturally (without any pressure) you may want to talk a while before an introduction. Such a situation would be if you both were in a waiting situation, such as a bus stop, waiting room, etc. The introduction can then be done casually. "By the way, my name is etc. etc."