pull data from wordpress database

The following should do the trick:

global $wpdb ;

// get the post_ids from the custom table
$sql = "SELECT listing_id FROM {$wpdb->prefix}wpdbdp_listing_fees WHERE fee_id = %d" ;
$sql = $wpdb->prepare ($sql, 4) ;
$post_ids = $wpdb->get_col ($sql) ;

// get the custom posts from the posts table
$args = array (
    'post__in' => $post_ids,
    'post_type' => 'wpbdp_listing',
    ) ;
$posts = new WP_Query ($args) ;

foreach ($posts->posts as $the_post)
    echo $the_post->post_title ;
    }

Note the use of $wpdb->prefix in the SQL statement.