And Welsh full-back Halfpenny added another three-pointer in the second half to add daylight between the sides.
The Warriors wasted good chances before Ryan Grant delivered a late try for the home side, which was converted, but Cardiff held on for a vital 9-7 victory which boosted their hopes in Pool 2.
But for Townsend the scoreline didn't reflect the way the game panned out.
"The effort we put into that and to score what we believe were two tries and to get nothing was tough," said Townsend.
"I have to say the try that Niko (Matawalu) scored was a clear try in my book. If you're clearing a ruck and someone hits and goes through that hole, then it's a try. I must be coaching something different, I don't know those laws.
"And to have penalty after penalty from scrum and from them to kick through the ball at the scrum, illegally I believe, and not to get a penalty try for that was very frustrating and disappointing."
Follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the RaboDirect PRO12