If you want to re-use the derived table, you need to declare it as CTE before the final query.
However, I see no need to do so in your case, just use tblProductDetails directly (aliased as you want it).
E.g.
select PD.ProductId as Id,
stuff((select ',' + CAST(PD2.SpeValue as varchar(100))
from tblProductDetails PD2
where PD.ProductId = PD2.ProductId
for xml path('')),1,1,'') AS [Name]
from tblProductDetails PD group by PD.ProductId
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles