function remove_custom_taxonomy(){
if ($_GET['post'] && !empty($_GET['post'])) {
$post=trim(stripslashes($_GET['post']));
if ((int)$post) {
if (!in_category( array('category1', 'category2'), $post )) {
remove_meta_box( 'css-block-taxonomydiv', 'post', 'side' );
}
}
}
}
add_action( 'admin_menu', 'remove_custom_taxonomy' );