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.
Of course a lot can depend on the circumstances. Sometimes the situation is such that it is quite appropriate for a full introduction right away. Such would be the case if it were apparent that you and the girl were going to be engaged together in some activity, like a game of tennis, a ski run, a dance, or sharing a table (dining or drinking); or if the girl was particularly friendly.
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."