Yes, an IFR flightplan can be cancelled at any time. The pilot simply tells ATC "cancelling my IFR flight", then it is cancelled. Depending on airspace classification, ATC may need to issue a clearance to continue as a VFR flight.
However, diverting to another destination than originally planned is not the same as cancelling a flightplan. To do so, the pilot will just inform ATC that they are diverting, and then ATC will provide an appropriate route to fly to get to the new destination. The reporting office at the new destination will, when the flight has landed, send a standard message to the original destination, stating that the flight has landed elsewhere.
Most deviations from your filed flightplan does not actually require an update of the flightplan itself. After all, the flightplan is only the plan you intend to follow at time of departure (or really, at time of filing the plan). Very few flights end up actually following their flightplan to the letter. ATC always keeps a local copy of your flight data, which is updated with any clearances given and other requests that might deviate from your original plan. If the deviation, whatever it may be, affects a downstream ATC sector, it can easily be coordinated verbally. However, if, in some rare case, you need to actually amend your flightplan while in the air, just inform ATC. The controller can either make the required changes (and send related AFTN message) directly, or get in touch with a flight data assistant that can take care of it.