Lot's of histories murderers used the excuse "I was just paying the bills"
Think about what your priorities are, and how valuable you are to the company and work it out for yourself.
I know in my situation my boss would take my advice seriously, if your boss is trying to patent your work he probably takes you seriously as well, explain the legal concerns, bring up prior work if there is any, and try to explain how it will not benefit the company in the long term and you might get away with your point of view.
Some points to argue would be that revenue/security earned by that patent will likely be outweighed by legal costs.
Also you may be play the angle that not getting a patent keep your trade-secrets safe, once they are patented the entire world knows about it.
Otherwise, sabotage it purposefully, at least try to go the peaceful negotiation route first. It's not hard, just file a preliminary patent over even if it's crappy and gets rejected, which would immediately disarm any lawsuit based on that past-work.