Ok, gotcha. So Tom's nearby comment about allowing the "p_rowtype%TYPE" syntax to be used in the CAST is spot on (as usual). In other words, to get a complete solution for you we would need to make both things work, so you could do this inside plpgsql:
select * from cast(dblink(connstr, sql) as p_rowtype%TYPE);
where potentially connstr, sql, p_rowtype are all passed to plpgsql as arguments. Correct?