get_categories() for only CPT

You should use wp_get_post_terms() instead of get_categories(). It returns an array of terms associated with a post.

<?php
function get_my_custom_terms() {
    global $post;
    $myterms = wp_get_post_terms($post->ID, 'location');

    if ($myterms) {
        foreach($myterms as $term) {
            $termname = $term->name;
            $term_link = get_term_link( $term->slug, 'location' );
                if( is_wp_error( $term_link ) ) {
                    $termlink = $term_link;
                } else {
                    $termlink = "https://wordpress.stackexchange.com/jobs/?location=" .$term->slug;
                }
            echo '<li><a href="' . $termlink . '">'. $termname .'</a></li>';
        }
    }
}