You can use a membrane to prevent the transfer of molecules from one place to another.