Show access denied page to the user
I think you are looking for the function which returns the access denied page; that is  drupal_access_denied(). Just call this function inside your conditional statement.