You are not obliged (since October 2003) to get the car serviced by a franchise dealer during the warranty period.
You must though get it serviced according to the manufacturer's recommended schedule and criteria using only manufacturer approved parts.
The legislation only applies to the part of the warranty offered by the manufacturer, i.e. insurance-backed extended warranties offered by dealers are not covered and may stipulate different conditions.
If you do get the car serviced outside the dealer networkyou must make sure it's done to the maker's recommended schedule and criteria using approved parts. You must also keep records so you can demonstrate to the manufacturer that servicing was undertaken to their requirements.
You should still get warranty work undertaken by the franchised dealer as it is easier for them to deal directly with the manufacturer.
Read about repairs after the warranty expires before deciding to go outside the dealer network for servicing during the warranty.