By default, Odoo uses the “Company” field on products and contacts to define in which companies a record will be available. This leads to an “all or one” situation in which all companies will have access to this record or only one will have it.

Until now the workaround was if a record is shared between 2 or more companies, leave it for blank to be shown in all companies. Some companies need more punctual control over which records are available in each company.
A solution for this problem is to create separate companies as branches, then you can separate products by main company and will only be available for companies whose branches are in that company without the need for customizations.
Example:
You have 3 companies:
Company A
Company B
Company C
You want some products to show for only company A & B but not C
- Create a new “Main” company.
- Set A and B as branches of that Main company.
- Assign the product to Main.
This way the product will be visible for Companies A&B but not C.
There's a good solution from Ray Carnes if you don't mind doing a bit of light development: https://www.odoo.com/forum/help-1/multicompany-how-can-i-share-only-some-products-between-companies-170837