Use DtWsmSetWorkspacesOccupied().
In occupy.c, the callback setCB() for the Set Occupancy push button calls this function.
DtWsmSetWorkSpacesOccupied XtDisplay(toplevel), XtWindow(toplevel), paWsSet, numSet);
where:
XtDisplay(toplevel) is the X display.
XtWindow(toplevel) is the window to be placed in the workspaces.
paWsSet is a pointer to a list of workspace names that have been converted to X atoms.
numSet is the number of workspaces in the list.
See the DtWsmSetWorkspacesOccupied() man page for more information on this function.