You can certainly try. It's totally at discretion of the taxi driver if they check your immigration documents. Some may not care and simply drive you there as long as you're paying the fare.
Or you can get a US taxi to drop you at the border, you can cross yourself, and catch a Canadian taxi on the other side.
CBSA won't care how you get there.