I think know the snippet of code to use, not not sure where to insert this:

$where_str .= " AND p.master_categories_id != 350 ";

Any ideas?