You can declare ndof as the maximum for your two material so 3 displacements + 1 temperature = 4.
Then in the user element that you have for the displacement only, you can set masks to remove the equations for the temperature.
The masking of dofs is done in isw.eq.1 where you have to set ix(ndf,nen) to 1 to active dof and 0 to deactivate dof, see below
do i = 1,nen
do j = 1,3
ix(j,i) = 1 <--- activate u_x,u_y,u_x
enddo
ix(4,i) = 0 <--- deactivate T
enddo
This works assuming that you use user elements if you use feap's element I don't know how you can do it.