On Twitter, Google’s Gary Illyes said that links that point to non-existent (404) pages on your website do not count. This even applies to “soft” 404 pages, i.e. pages that show an error message but deliver a “200 OK” status code:
@SEO_Portal yes, they are. Generally, with a few exceptions, if a page is not indexed, its links are ignored too.— Gary Illyes (@methode) 10. August 2015
Remove bad backlinks
If you want to disavow bad links that point to your website, you can remove the page to which the links point. Google will disavow those links then. Of course, you can still use Google’s official disavow tool to remove bad backlinks.
The link disinfection tool in SEOprofiler helps you to identify bad backlinks that point to your website. It also creates a file that you can send to Google’s disavow links tool: