If I want to integrate with the NAICS system but want to "zoom in" on certain categories, and to add categories for various illicit or underground activities. Is there a standard way of extending the NAICS system?
I don't know of any existing standards (de facto or not) for extending NAICS, but what I would do is start with the NAICS Index File, which ties over 19,000 industry names to the standard 1,000 or so NAICS codes. Take the list of index entries for each NAICS, give each one a 2-digit sequential ID, and tack this onto the standard NAICS to make it 8-digit (assuming no more than 100 index entries for any given NAICS).
To keep with the spirit of NAICS, underground or illicit activities should be coded using similar standard codes, or under new codes in the hierarchy close to legitimate businesses that use similar inputs or production processes. E.g., "herbal" grow operations would go in "11: Crop Production". Smuggling operations would be in "48-49: Transportation and Warehousing". You may also want to look at a humorous anecdote involving a BLS recommendation for the SIC coding of legalized prostitution in Nevada in the 1970s.