You should be able to retrieve the object from the object table, then query for its RenderMaterial and change the transparency setting using the SetParameter method on the RenderMaterial.
I am not sure why making the assignment helps but it does!
complete solution:
var o = doc.Objects.Find(id);
var material = o.RenderMaterial;
material.BeginChange(RenderContent.ChangeContexts.Program);
material.SetParameter("transparency", 0.5);
material.EndChange();
o.RenderMaterial = material;
o.CommitChanges();
Assigning the render material explicitly ensures the object attributes get properly flagged for update so that the call to CommitChanges actually does something.
Your first method never sets the RenderMaterial property on the object, only gets from it. Just having the material changed is not enough clearly (:
A bit finnicky, but that is how it is designed.
I should add an example to my literate page that explains this clearly.