In case anyone has this problem in the future what I ended up doing was putting this code inside de init function of ProductController when it meets my condition:
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
$this->setTemplate('errors/404');
.png.022b5452a8f28f552bc9430097a16da2.png)