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');