Pretty direct. Try not to make it sound like an overly smooth "line" because that shyt is corny.
"Hey, you seem pretty cool. Can I drink with you?"
Being that direct catches people off guard an you can anchor yourself pretty easily. If you're at a dive bar you can invite the hottest girl to play a bar game with you. As long as you're in decent shape, well groomed, and not a total social retard, you should be fine. Above all else, if it feels forced and contrived, don't use it as a line. It just makes everyone awkward. And don't be too drunk. Have a drink in your hand, sure, so it looks like you're there to party, but yeah.