Well, it surely is not formal, but it's not rude. It could be "Jak pan ma na imię", although somehow I think I'd ask a stranger for a full name and ask "Jak się pan nazywa?".
"Jak ma na imię?" doesn't work here, it would be a question about some 3rd person singular subject that must be known from the context.