How to get post with slug and exclude categories

Please read this Codex page why you should not use query_posts().

If you really want to use query_posts():

query_posts(
    'name' => 'test',
    'category' => '-15' // notice "minus 15"
);

The right way to exclude category:

$query = new WP_Query(
    array(
        'name' => 'test',
        'category__not_in' => array(15)
    )
);

if ( $query->have_posts() ) {
    .....
}