You are not married to your pregnant ex-girlfriend. A single, unmarried mother is presumed by law to have complete custody and control of her child, and she makes all the decisions regarding it.. She can give her child any last name she wants to give it, and you have no legal say-so about it. That's what happens when a man has a child with a woman he's not married to.
However, if DNA proves that you're the biological father of the child, you WILL be ordered to make child support payments every month for the next 18 years, if the mother decides to go to Court and sue for payments. In return, the Court will probably grant you limited visitation rights.