if ( get_the_ID() !== 45 ) {
// Will run for all posts other than ID 45
}
if ( get_the_title() !== 'My Post' ) {
// Will run for all posts that don't have the title "My Post"
}
if ( get_post_field( 'post_name' ) !== 'my-post' ) {
// Will run for all posts that don't have the slug "my-post"
}