While a project is still live you can cancel your pledge by visiting the project page and clicking the "Manage your pledge” button on the right-hand side.
From there, click "Cancel Pledge" next to the "Change your pledge" link.
Remember, a pledge can only be cancelled while a project is live. If the project has ended and pledge collection has started it is no longer possible to cancel.