Is it possible to style a broken link (ie. one that tries to link to a non-existent page on your site) in a different colour? eg. working links are blue, broken links are red?
No, you cannot style a broken link with CSS. The browser does not know if a link is broken until some agent tries to access the link.
A scalable system that could work would be the have your server check the links you're using in your pages on some interval (perhaps once every few days), keep that info in a local database and then you can add a class to a link (server-side) when rendering the page and then a CSS rule can style that link differently. Plus, the server is not subject to same-origin restrictions so you don't have that limitation doing it server-side. There are lots of gotchas when determining off-line that you will have to watch out for because a host can be down temporarily, can be down only from a particular route on the internet, etc...