Given a set F of faulty edges or faulty vertices in the hypercube Qn and a pair of vertices u, v, is there a hamiltonian cycle or a hamiltonian path between u and v in Qn −F? We show that in case F consists of edges forming a matching, or of at most (n − 7)/4 vertices, then simple necessary conditions are also sufficient. On the other hand, if there are no restrictions on F, all these problems are NP-complete. The solution for faulty vertices was obtained as a special case of a more general result on partitioning Qn − F into vertex-disjoint paths with prescribed endvertices. We also consider a complementary problem with a prescribed set of edges.