It's not a question of legality. The electors and the DEM party are on the ballot in all 50 states.
Of course, there is a question of whether enough DEMs would vote for another candidate to win the elctoral college, but that is a practical matter, not a legal one.
Excellent point. In NY, you vote for a named elector N who is promised to vote for X. If X suddenly isn't available, or the electoral vote has no majority, then N can vote for anyone.