including 404 page in post page

The most efficient way to do it would be to have a whitelist of pages, and to check the requested page against that list before the query is run.

function my_parse_query( $wp_query ) {
    if( isset( $wp_query->query_vars['sub_pages'] ) ){
        $sub_pages = array(
            'example',
            'another'
        );
        if( ! in_array( $wp_query->query_vars['sub_pages'], $sub_pages ) ){
            $wp_query->set_404();
            status_header( 404 );
        }
    }
}
add_action( 'parse_query', 'my_parse_query' );

Then, once you reach the post type template, you know that if sub_pages is set at that point, it contains one of your defined valid pages.