According to the FIDE Laws of Chess:
9.2.2 Positions are considered the same if and only if the same player has the move, pieces of the same kind and colour occupy the same squares and the possible moves of all the pieces of both players are the same. Thus positions are not the same if:
9.2.2.1 at the start of the sequence a pawn could have been captured en passant
9.2.2.2 a king had castling rights with a rook that has not been moved, but forfeited these after moving. The castling rights are lost
only after the king or rook is moved.
Hence the answer to
With respect to threefold repetition, would the positions be
considered the same if:
In the first position, the king cannot castle because it is in check,
pieces are blocking, or for some other reason, but it could castle
otherwise
Although castling is temporarily prevented the king still has castling rights. They are not lost if castling is temporarily prevented by check or blocking pieces. They are only lost if the king or rook moves.
With regard to:
With respect to threefold repetition, would the positions be
considered the same if:
In the second position, the king cannot castle because it has already
moved.
The rules are clear. If the king has lost castling rights since the the first position then the positions are not the same and a draw cannot be claimed.
Does permanent loss of castling rights reset three fold repetition?
Yes. That's what the rule says.