use
IN
cláusula como $this->db->where('a.PreferenceID NOT IN (
SELECT PreferenceParentID FROM '.$table.'
WHERE EntityID IN ('.implode(",", $array).'))',
NULL, FALSE
);
IN
cláusula como $this->db->where('a.PreferenceID NOT IN (
SELECT PreferenceParentID FROM '.$table.'
WHERE EntityID IN ('.implode(",", $array).'))',
NULL, FALSE
);