If B knows what he is doing, he can easily place a mechanic's lien on your property. A mechanic's lien doesn't need a mutual consent or a contract and is based on the fact that he worked on your property. The only way to stop someone from placing a mechanic's lien is to file a notice of non-responsibility with county's recorder's office with certain time limit such as within 10 days with your knowledge of that someone is working on your property.
This matter has nothing to do with A as far as the lien is concerned. However you can file a lawsuit against A if you know where to find him.
B is innocent and deserves a payment either from A or owner. Since the A disappears, B has the right to collect payment from the owner. This is very typical situation.
As an owner, you can file "Release of Lien Bonds" to protect you from foreclosing your property via a court order by paying surety with 150% of the claim. That will be a complicated but it's doable. Once you filed the bond, the lien will be removed.