What is the purpose of
ip route 0.0.0.0 0.0.0.0 null0
in a core router of an ISP running BGP?
ip route 0.0.0.0 0.0.0.0 null0 will drop all unknown destinations. Without a more complete configuration it is difficult to hypothesize its full purpose.
A popular ISP service is to provide a private Layer 3 MPLS cloud without Internet access. In this scenario, the customer branch location would send their default traffic (Internet traffic) to the customer HQ, rather than directly to their ISP.
ip route 0.0.0.0 0.0.0.0 null0 would be in the customer VRF and could be a safeguard on the provider side to drop all other traffic.
It may have different purposes. One of the most popular is to announce default route to customers with
default-information originate. Dropping all unknown destinations (e. g. RFC1918 subnets) in order to prevent traffic loops till TTL exceeds may also be a reason.
There are already some useful answers here, but one other reason to insert a default route pointing to the discard interface is to prevent traffic to unreachable destinations (for example traffic for networks which dropped out of the default free zone) from being transported throughout the ISP's network. This can happen if routers within the ISP's network do have a default route pointing to other routers, possibly eachother, which would result into routing loops.